package com.fit.beans;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import com.fit.enums.CityEnum;
import com.fit.interfaces.CityI;
import com.fit.interfaces.ClientAddressI;

@Entity 
@Table (uniqueConstraints = {@UniqueConstraint(columnNames = {"postalCode"})})
public class CityBean implements CityI {
	@Id
	private int postalCode;
	@Column(nullable = false)
	private String city;
	
	@OneToMany(targetEntity = ClientAddressBean.class, mappedBy = "city")
	private List<ClientAddressI> clientsAddress;
	
	
	public void setPostalCode(int postalCode) {
		this.postalCode = postalCode;
	}
	public int getPostalCode() {
		return postalCode;
	}
	/* (non-Javadoc)
	 * @see com.fit.beans.CityI#getCity()
	 */
	public String getCity() {
		return city;
	}
	/* (non-Javadoc)
	 * @see com.fit.beans.CityI#setCity(java.lang.String)
	 */
	public void setCity(String city) {
		this.city = city;
	}
	public List<ClientAddressI> getClientsAddress() {
		return clientsAddress;
	}
	public void setClientsAddress(List<ClientAddressI> clientsAddress) {
		this.clientsAddress = clientsAddress;
	}
	
	
	
	
}
